<!--
*Author：富行天下团队
 *
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/mall/Mall_distri_product.js此处编写
 -->
<template>
  <div>
    <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields"
      :editFormFileds="editFormFields" :editFormOptions="editFormOptions"
      :searchFormFields="searchFormFields" :searchFormFileds="searchFormFields"
      :searchFormOptions="searchFormOptions" :table="table" :extend="extend">
    </view-grid>
  </div>
</template>

<script>
import extend from "@/extension/mall/Mall_distri_product.js";
import ViewGrid from "@/components/basic/ViewGrid.vue";
var vueParam = {
  components: {
    ViewGrid,
  },
  data() {
    return {
      productList: [],
      table: {
        key: "id",
        footer: "Foots",
        cnName: "产品发布",
        name: "Mall_distri_product",
        url: "/distriProducts/",
        sortName: "createDate",
      },
      extend: extend,
      editFormFields: {
        isShare: "",
        isPublic: "",
        auditStatus: "",
        productName: "",
        timeContainer: "",
        distributionid: "",
        afewdaysahead: "0",
        serch: "",
        sort: "0",
        isPreSale: "",
        verificationrulesid: "",
        spare15: "",
        isSellLikeHot: "",
        productid: "",
        tre: "",
        typeName: "",
        modifyDate: "",
        producttype: [],
        spare1: "",
        createDate: "",
        sellingRulesid: "",
        supplierid: "",
        refundrulesid: "",
        effectiveStartDate: "",
        effectiveEndDate: "",
        modifier: "",
        creator: "",
        isAvailable: "",
        code: "",
        status: "",
        creator: "",
        createID: "",
        createDate: "",
        modifier: "",
        modifyID: "",
        modifyDate: "",
        merchantCode: "",
        merchantName: "",
        periodTicket:"0",
        isShowRackrate: "",
        isDepositFree: "",
        distriPattern: 0,
        distriPriceOrRatio: 1,
      },
      editFormOptions: [
        [
          {
            title: "分销商",
            required: true,
            field: "distributionid",
            type: "select",
            dataKey: "distributorList",
            colSize: 4,
          },
          {
            title: "起止时间",
            required: true,
            field: "timeContainer",
            type: "datetime",
            range: true,
            colSize: 4,
          },
          { title: "状态", type: "text", field: "status", colSize: 2 },
          {
            title: "是否热销",
            required: true,
            field: "isSellLikeHot",
            type: "switch",
            colSize: 2,
          },
        ],
        [
          {
            title: "供应商",
            required: true,
            disabled: true,
            field: "supplierid",
            type: "select",
            dataKey: "mall_supplier",
            colSize: 4,
            hidden: true,
          },
          {
            title: "企业码",
            type: "text",
            field: "code",
            colSize: 6,
            hidden: true,
          },
        ],
        [
          {
            title: "售卖规则",
            required: true,
            field: "sellingRulesid",
            type: "select",
            dataKey: "mall_sellingrules",
            colSize: 4,
          },
          {
            title: "退改规则",
            required: true,
            field: "refundrulesid",
            type: "select",
            dataKey: "Mall_refundrules",
            colSize: 4,
          },
          {
            title: "核销规则",
            required: true,
            field: "verificationrulesid",
            type: "select",
            dataKey: "mall_verificationrules",
            colSize: 4,
          },
        ],
        [
          {
            title: "开始时间",
            field: "effectiveStartDate",
            type: "datetime",
            colSize: 6,
            hidden: true,
          },
          {
            title: "结束时间",
            field: "effectiveEndDate",
            type: "datetime",
            colSize: 6,
            hidden: true,
          },
        ],
        [
          {
            title: "搜索关键字",
            field: "serch",
            colSize: 4,
            type: "selectList",
            dataKey: "Label",
          },
          { title: "排序", field: "sort", type: "number", colSize: 4, min: 0 },
          {
            title: "是否期票",
            field: "periodTicket",
            required: true,
            colSize: 2,
            type: "switch",
          },
        ],
        [
          {
            title: "是否预售",
            required: true,
            field: "isPreSale",
            type: "switch",
            colSize: 2,
          },
          {
            title: "提前几天",
            hidden: true,
            field: "afewdaysahead",
            type: "number",
            colSize: 4,
          },
          {
            title: "是否审核",
            required: true,
            field: "auditStatus",
            type: "switch",
            colSize: 2,
          },
          {
            dataKey: "enable",
            data: [],
            title: "是否公开",
            field: "isPublic",
            colSize: 2,
            type: "switch",
          },
          {
            dataKey: "enable",
            data: [],
            title: "是否分享",
            field: "isShare",
            colSize: 2,
            type: "switch",
          },
          {
            dataKey: "enable",
            data: [],
            title: "是否展示门市价",
            field: "isShowRackrate",
            colSize: 3,
            type: "switch",
          },
          {
            dataKey: "enable",
            data: [],
            title: "是否免押(支付宝)",
            field: "isDepositFree",
            colSize: 3,
            type: "switch",
          },
        ],
        [
          {
            title: "产品类型",
            field: "typeName",
            dataKey: "tree_protype",
            hidden: true,
            colSize: 4,
            type: "text",
          },
          {
            title: "产品类型",
            field: "producttype",
            type: "cascader",
            dataKey: "tree_protype",
            hidden: true,
            colSize: 4,
            disabled: true,
            changeOnSelect: true,
          },
          {
            title: "产品名称",
            required: true,
            field: "productid",
            type: "text",
            colSize: 4,
            disabled: true,
            data: [],
          },
          {
            title: "产品名称",
            field: "productName",
            type: "text",
            colSize: 4,
            hidden: true,
            disabled: true,
          },
          {
            title: "库存数",
            required: true,
            field: "spare1",
            type: "number",
            min: 0,
            colSize: 4,
          },
        ],
        [
          {
            title: "分销模式",
            field: "distriPattern",
            colSize: 4,
            type: "radio",
            data: [
              { key: 0, value: "底价模式" },
              { key: 1, value: "佣金模式" },
            ],
            hidden: true,
          },
          {
            title: "分销计算类型",
            field: "distriPriceOrRatio",
            type: "radio",
            colSize: 4,
            hidden: true,
            data: [
              { key: 1, value: "固定金额" },
              { key: 2, value: "按照比例" },
            ],
          },
          {
            title: "一级分销佣金",
            field: "firstCommission",
            type: "decimal",
            min: 0,
            colSize: 4,
            hidden: true,
          },
        ],
        [
          {
            title: "二级分销佣金",
            field: "secondCommission",
            type: "decimal",
            min: 0,
            colSize: 4,
            hidden: true,
          },
        ]
      ],
      searchFormFields: {
        effectiveState: "",
        goodcode: "",
        auditStatus: "",
        productName: "",
        supplierid: "",
        distributionid: "",
        typeName: "",
        effectiveStartDate: "",
        effectiveEndDate: "",
        sellingRulesid: "",
        creator: "",
      },
      searchFormOptions: [
        [
          { title: "产品名称", field: "productName", type: "like" },
          // { "title": "产品名称", "field": "productid", "type": "select", "dataKey": "Products" },
          {
            title: "供应商",
            field: "supplierid",
            type: "select",
            dataKey: "mall_supplier",
          },
          {
            title: "分销商",
            field: "distributionid",
            type: "select",
            dataKey: "distributorList",
          },
          {
            title: "产品类型",
            field: "typeCode",
            type: "select",
            dataKey: "tree_protype",
          },
        ],
        [
          { title: "开始时间", field: "effectiveStartDate", type: "datetime" },
          {
            title: "售卖规则",
            field: "sellingRulesid",
            type: "select",
            dataKey: "mall_sellingrules",
          },
          {
            title: "退改规则",
            field: "refundrulesid",
            type: "select",
            dataKey: "Mall_refundrules",
          },
          {
            title: "是否审核",
            field: "auditStatus",
            type: "select",
            dataKey: "audit",
          },
        ],
        [
          { field: "goodcode", title: "商品编码", type: "like" },
          {
            dataKey: "ProductValidityStatus",
            data: [],
            title: "是否有效",
            field: "effectiveState",
            type: "select",
          },
        ],
      ],
      columns: [
        {
          field: "id",
          title: "主键",
          type: "string",
          width: 90,
          hidden: true,
          readonly: true,
          require: true,
          align: "left",
        },
        {
          field: "productName",
          title: "产品名称",
          type: "string",
          width: 200,
          align: "left",
        },
        // { field: 'productid', title: '产品名称', type: 'string', bind: { key: 'ProductLists', data: [] }, width: 220, align: 'left', sortable: true },
        {
          field: "distributionid",
          title: "分销商",
          type: "string",
          bind: { key: "distributorList", data: [] },
          width: 220,
          align: "left",
          sortable: true,
        },
        {
          field: "typeName",
          title: "产品类型",
          type: "string",
          bind: { key: "tree_protype", data: [] },
          width: 120,
          align: "left",
        },
        {
          field: "sellingRulesName",
          title: "售卖规则",
          type: "string",
          width: 200,
          align: "left",
        },
        {
          field: "refundrulesName",
          title: "退改规则",
          type: "string",
          width: 200,
          align: "left",
        },
        {
          field: "verificationrulesName",
          title: "核销规则",
          type: "string",
          width: 200,
          align: "left",
        },
        {
          field: "auditStatus",
          title: "审核状态",
          type: "string",
          width: 80,
          bind: { key: "audit", data: [] },
          align: "left",
        },
        {
          field: "serch",
          title: "搜索关键字",
          type: "string",
          bind: { key: "Label", data: [] },
          width: 200,
          align: "left",
        },
        {
          field: "sort",
          title: "排序",
          type: "string",
          width: 100,
          align: "left",
        },
        {
          field: "isPreSale",
          title: "是否预售",
          bind: { key: "enable", data: [] },
          type: "int",
          width: 90,
          align: "left",
          sortable: true,
        },
        //{field:'code',title:'产品编码',type:'string',bind: { key: 'Products', data: [] },width:120,align:'left'},
        //{field:'productid',title:'产品',type:'string',bind: { key: 'ProductLists', data: [] },width:120,align:'left'},
        // { field: 'distributionid', title: '分销商', type: 'string', bind: { key: 'distributorList', data: [] }, width: 220, align: 'left', sortable: true },
        // {field:'supplierid',title:'供应商',bind: { key: 'mall_supplier', data: [] },type:'string',width:120,align:'left',sortable:true},
        //{field:'sellingRulesid',title:'售卖规则',bind: { key: 'mall_sellingrules', data: [] },type:'string',width:120,align:'left'},
        //{field:'refundrulesid',title:'退改规则',bind: { key: 'Mall_refundrules', data: [] },type:'string',width:120,align:'left'},
        //{field:'verificationrulesid',title:'核销规则',bind: { key: 'mall_verificationrules', data: [] },type:'string',width:120,align:'left'},
        {
          field: "effectiveStartDate",
          title: "开始时间",
          type: "datetime",
          width: 220,
          align: "left",
          sortable: true,
        },
        {
          field: "effectiveEndDate",
          title: "结束时间",
          type: "datetime",
          width: 220,
          align: "left",
          sortable: true,
        },
        {
          field: "creator",
          title: "创建人",
          type: "string",
          width: 135,
          align: "left",
        },
        {
          field: "createDate",
          title: "创建时间",
          type: "datetime",
          width: 220,
          align: "left",
          sortable: true,
        },
        {
          field: "modifier",
          title: "修改人",
          type: "string",
          width: 135,
          align: "left",
        },
        // {field:'isSellLikeHot',title:'是否热销',bind: { key: 'enable', data: [] },type:'int',width:135,align:'left',sortable:true},
        {
          field: "modifyDate",
          title: "修改时间",
          type: "datetime",
          width: 220,
          align: "left",
          sortable: true,
        },
        // {field:'modifyID',title:'修改人ID',type:'int',width:90,hidden:true,align:'left'},
        // {field:'createID',title:'创建人ID',type:'int',width:90,hidden:true,align:'left'},
        // {field:'isAvailable',title:'是否可用',bind: { key: 'enable', data: [] },type:'int',width:90,align:'left'},
      ],
      detail: {
        cnName: "发布商品 ",
        columns: [
          {
            field: "id",
            title: "主键",
            type: "string",
            width: 90,
            hidden: true,
            readonly: true,
            require: true,
            align: "left",
          },
          {
            field: "spare2",
            title: "商品编码",
            type: "string",
            width: 150,
            align: "left",
            fixed: "left",
          },
          {
            field: "spare1",
            title: "商品名称",
            type: "string",
            width: 150,
            edit: { type: "text" },
            align: "left",
            fixed: "left",
          },
          {
            field: "sellingPrice",
            title: "门市价",
            type: "string",
            width: 100,
            edit: { type: "decimal" },
            align: "left",
          },
          {
            field: "preferentialPrice",
            title: "售价",
            type: "string",
            width: 90,
            edit: { type: "decimal" },
            min: 0,
            align: "left",
          },
          // {
          //   field: "vipPrice",
          //   title: "会员价",
          //   type: "string",
          //   width: 90,
          //   edit: { type: "decimal" },
          //   min: 0,
          //   align: "left",
          // },
          {
            field: "settlementPrice",
            title: "结算价",
            type: "string",
            width: 90,
            edit: { type: "decimal" },
            min: 0,
            align: "left",
          },
          // {
          //   field: "channelPrice",
          //   title: "渠道价",
          //   type: "string",
          //   width: 90,
          //   edit: { type: "decimal" },
          //   min: 0,
          //   align: "left",
          // },
          {
            field: "isAvailable",
            title: "是否可用",
            type: "int",
            edit: { type: "switch" },
            width: 90,
            align: "left",
          },
          {
            field: "spare6",
            title: "会员价json",
            type: "string",
            width: 90,
            align: "left",
            hidden: true,
          },
        ],
        sortName: "id",
        key: "id",
      },
    };
  },
};
export default vueParam;
</script>
